<extend name="Layout:list" />
<block name="title"><title>菜单管理</title></block>
<block name="main">
    <form name="myform" action="__CONTROLLER__/listorder" method="post" id="myform" >
        <div class="table-list">
            <table width="100%" cellspacing="0">
                <thead>
                    <tr>
                        <th width="50">排序</th>
                        <th width="92">ID</th>
                        <th>菜单名称</th>
                        <th width="147">状态</th>
                        <th width="143">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($menus as $key => $menu) { ?>
                    <tr>
                        <td align="center"><input type="text" style="width: 36px; text-align: center; height: 18px; margin: 0;" name="sort[<?php echo $menu['id']; ?>]" value="<?php echo $menu['sort']; ?>" /></td>
                        <td  width="92" align='center'><?php echo $menu['id']; ?></td>
                        <td><?php echo cat_empty_deal($menu, isset($menus[$key+1]) ? $menus[$key+1]['pid'] : '', 'pid').$menu['title']; ?></td>
                        <td align="center"><?php if($menu['status']==1){echo "启用";}else{echo "禁用";} ?></td>
                        <td align="center"><a href="__MODULE__/Menu/add/menu_id/<?php echo $menu['id']; ?>">添加子菜单</a> | <a href="__MODULE__/Menu/edit/nid/<?php echo $menu['id']; ?>">修改</a> | <a class="delete" href="__MODULE__/Menu/del/nid/<?php echo $menu['id']; ?>">删除</a></td>
                    </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
        <div class="mt-20">
            <input type="submit" class="btn" name="dosubmit" value="排序"/>
        </div>
    </form>
</block>
<block name="footer">
    <script type="text/javascript">
        $(function(){
            $(".delete").click(function( e ){
                _this = $(this);
                e.preventDefault();
                window.top.art.dialog({
                    content:'确认删除该菜单和其子菜单？',
                    lock:true,
                    width:'200',
                    height:'50',
                    cancel: true,
                    ok: function () {
                        document.location.href = _this.attr('href');
                    }
                });
            })
        })
    </script>
</block>